package com.greenold.service.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.greenold.service.domain.vo.CareTaskVO;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.greenold.common.annotation.Log;
import com.greenold.common.core.controller.BaseController;
import com.greenold.common.core.domain.AjaxResult;
import com.greenold.common.enums.BusinessType;
import com.greenold.service.domain.CareTask;
import com.greenold.service.service.ICareTaskService;
import com.greenold.common.utils.poi.ExcelUtil;
import com.greenold.common.core.page.TableDataInfo;

/**
 * 护理任务Controller
 *
 * @author YueYang
 * @date 2025-10-14
 */
@RestController
@RequestMapping("/service/task")
public class CareTaskController extends BaseController {
    @Autowired
    private ICareTaskService careTaskService;

    /**
     * 查询护理任务列表
     */
    //@PreAuthorize("@ss.hasPermi('service:task:list')")
    @GetMapping("/list")
    public TableDataInfo list(CareTask careTask) {
        startPage();
        List<CareTaskVO> list = careTaskService.selectCareTaskList(careTask);
        return getDataTable(list);
    }


    /**
     * 获取护理任务详细信息
     */
    //@PreAuthorize("@ss.hasPermi('service:task:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(careTaskService.selectCareTaskById(id));
    }


    /**
     * 更新护理任务
     */
    //@PreAuthorize("@ss.hasPermi('service:task:cancel')")
    @PutMapping("/update")
    @Log(title = "护理任务", businessType = BusinessType.UPDATE)
    public AjaxResult cancel(@RequestBody CareTask careTask) {
        return toAjax(careTaskService.updateCareTask(careTask));
    }


}
